package com.example.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.dao.EmployeeDao;
import com.example.domain.Employee;
import com.example.service.EmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class EmployeeServiceImpl extends ServiceImpl<EmployeeDao,Employee>  implements EmployeeService {
    @Autowired
    private EmployeeDao employeeDao;
    @Override
    public Employee selectemployeebyusername(String username) {
//        LambdaQueryWrapper<Employee> lambdaQueryWrapper=new LambdaQueryWrapper<>();
//        lambdaQueryWrapper.eq(Employee::getUsername,username);
//        Employee employee = employeeDao.selectOne(lambdaQueryWrapper);
        Employee employee = employeeDao.selectemployeebyusername(username);
        return employee;
    }

    @Override
    public void addemployee(Employee employee) {
        employeeDao.saveemployee(employee);
    }

    @Override
    public List<Employee> selectallbypage(int pagecount,int pageSize) {
       return employeeDao.selectallbypage(pagecount,pageSize);
    }

    @Override
    public long selectcount() {
        long selectcount = employeeDao.selectcount();
        return selectcount;
    }

    @Override
    public List<Employee> selectbypageandname(int pagecount, int pageSize, String name) {
        return employeeDao.selectbypageandname(pagecount,pageSize,name);
    }

    @Override
    public void updatestatusbyid(Employee employee) {
        employeeDao.updatestatusbyid(employee);
    }

    @Override
    public Employee selectemployeebyid(Long id) {
        return employeeDao.selectemployeebyid(id);
    }

    @Override
    public void updateemployee(Employee employee) {
        employeeDao.updateemployee(employee);
    }


}
